<?php
	include('../../config/config.php');
	$gettoken   = constant('domainname')."/apptoken/token/echotoken.php"; //获取token 
	$token      = file_get_contents($gettoken);
	$getJsapi   = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token=".$token."&type=jsapi"; //获取jsapi_ticket 
	$getJsapi   = file_get_contents($getJsapi);
	$jsonObj    = json_decode($getJsapi);
	$ticket     = $jsonObj->ticket;
	$expires_in = $jsonObj->expires_in;
	$Getdata    = array('ticket'=>$ticket,'expires_in'=>$expires_in+time());
	$html       = json_encode($Getdata);
	$myfile     = fopen("ticket.data", "w") or die("Unable to open file!");
	fwrite($myfile, $html);
	fclose($myfile);
	echo $html;
?>
